package net.jacqeush.mini.rpc.handler;

import java.util.concurrent.TimeUnit;

/**
 * @author Jacquesh
 * @version 1.0
 * @date 2020/10/16 2:10
 */
public  class AvailableAndWaitHandler extends AbstractHandler {
    public static void  available(){
        connectedLock.lock();
        try {
            connectedCondition.signalAll();
        } finally {
            connectedLock.unlock();
        }
    }
    public static boolean waiting() throws InterruptedException {
        connectedLock.lock();
        try {
            return connectedCondition.await(connectTimeoutMills, TimeUnit.MICROSECONDS);
        } finally {
            connectedLock.unlock();
        }
    }
}
